package com.flick.common;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * 此类可以取得Spring的上下文.
 * Spring 使new方法创建的对象可以引用spring管理的bean.
 * Created by flick on 2017/4/23.
 */
public class SpringContext implements ApplicationContextAware {
    protected static ApplicationContext context;

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }

    public static ApplicationContext getContext() {
        return context;
    }
}
